package com.dailyblue.project.estate.config;

import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther:Liu
 * @Testname:ChatmemoryConfig
 * @Date:2025/9/26 10:47
 */

/**
 * 轮询记忆配置
 */
@Configuration
public class ChatMemoryConfig {
    //sql记忆
    @Bean("jdbcChatMemory")
    public ChatMemory jdbcChatMemory(JdbcChatMemoryRepository jdbcChatMemoryRepository) {
        return MyMessageWindowChatMemory
                .builder()
                .chatMemoryRepository(jdbcChatMemoryRepository)
                .maxMessages(20)
                .build();
    }
}
